package com.slz3.business.module.configManagement.conIndexVideo.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class ConIndexVideoFactory {

    /**
     * 初始化基础属性值
     */
    public static ConIndexVideo initBaseFields(ConIndexVideo conIndexVideo) {
        if (conIndexVideo.getUuid() == null) {
            conIndexVideo.setUuid(UUIDUtils.generateUUID());
            conIndexVideo.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(conIndexVideo.getSerAudit())) {
                conIndexVideo.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(conIndexVideo.getSerUsing())) {
                conIndexVideo.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            conIndexVideo.setLastModifyTime(LocalDateTime.now());
        }
        return conIndexVideo;
    }

    /**
     * 初始化基础属性值
     */
    public static ConIndexVideo initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static ConIndexVideo newTemStyle() {
        return new ConIndexVideo();
    }

}
